<template>
  <el-button class="niupi-btn" :style="btnStyleFn" :icon="btnType.icon" @click="click">
    <slot>
      <!--显示父元素内容-->
    </slot>
  </el-button>
</template>
<script>
import frameworkUtil from "@/framework/js/frameworkUtil.js";
export default {
  props: {
    type: {
      type: String,
      //   required: true
    }
  },
  created () {
    // console.log(frameworkUtil)
    this.btnType = frameworkUtil.btnType[this.type];
  },
  data: {
    btnType: undefined,
  },
  computed: {
    btnStyleFn () {
      return { background: this.btnType.backgroundColor }
    }
  },
  methods: {
    click (e) {
      //触发父组件的click事件
      this.$emit('click', e)
    }
  }
}
</script>

<style scoped>
.niupi-btn {
  color: white;
}
</style>